package com.github.shuaidd.model.repository;

import com.github.shuaidd.model.entity.ModelEntity;
import org.activiti.app.domain.editor.Model;
import org.activiti.app.domain.editor.ModelInformation;
import org.activiti.app.domain.editor.ModelRelation;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ModelEntityMapper {
    int deleteByPrimaryKey(String id);

    int insert(Model record);

    int insertSelective(Model record);

    Model selectByPrimaryKey(String id);
    Model selectByModelKey(String modelKey);

    int updateByPrimaryKeySelective(Model record);

    int updateByPrimaryKeyWithBLOBs(Model record);

    int updateByPrimaryKey(ModelEntity record);

    List<Model> findModelsByParentModelId(String id);

    List<Model> findModelsCreatedBy(@Param("userId") String userId, @Param("modelTypeApp") int modelTypeApp, @Param("filter") String filter, @Param("orderByFormat") String orderBy);

    List<ModelRelation> findByParentModelIdAndType(@Param("parentModelId") String parentModelId, @Param("type") String relationType);

    int deleteModelRelation(ModelRelation relation);

    List<Model> findModelsByKeyAndType(@Param("key") String key, @Param("modelType") Integer modelType);

    List<Model> findModelsByModelType(@Param("modelType") int modelType, @Param("validFilter") String validFilter);

    List<ModelInformation> findParentModels(String modelId);

    int deleteModelRelationsForParentModel(String parentModelId);

    String appDefinitionIdByModelAndUser(@Param("modelId") String modelId, @Param("userId") String userId);
}
